<?php
require_once('tpl/head.php');
include_once('./system/dbConn.php');
connect();
//接收tid参数，写sql语句，对取到的数据做处理
$tid=$_GET["tid"];
$sql0="select * from videotype where tid=$tid";//读取栏目名称
$result0=mysql_query($sql0);
$row0=mysql_fetch_assoc($result0);


//读取当前栏目中的所有视频信息
$sql="select * from videos where tid=$tid";
$result=mysql_query($sql);//多条记录的结果集


//读取当前栏目点击量排行前四的视频
$sqlorder="select * from videos where tid=$tid order by hittimes desc limit 4 ";
$resultorder=mysql_query($sqlorder);


?>


<div class="container">

    <div class="row row-offcanvas row-offcanvas-right">

        <div class="col-xs-12 col-sm-9">


            <div class="row">


                <div class="col-xs-12 col-lg-12 mlist">
                    <h2><?php echo $row0["typename"]; ?></h2>
                    <ul class="list-inline row text-center">

<?php 
    while ($row=mysql_fetch_assoc($result)) {
        ?>
                        <li class="col-xs-6 col-lg-3">
                            <img src="./posters/<?php echo $row["pic"]; ?>" class="responsive img-thumbnail"/>
                            <p><a href="show.php?vid=<?php echo $row["vid"]; ?>"><?php echo $row["videoname"]; ?></a>
                            </p>
                        </li>
        <?php
    }
?>
                    </ul>
                    <nav class="text-center">
                        <ul class="pagination">
                            <li>
                               <!--  //分页 -->
                                <a href="#" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                            <li><a href="#">1</a></li>
                            <li><a href="#">2</a></li>
                            <li><a href="#">3</a></li>
                            <li><a href="#">4</a></li>
                            <li><a href="#">5</a></li>
                            <li>
                                <a href="#" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </ul>
                    </nav>


                </div>
                <!--/.col-xs-6.col-lg-4-->

            </div>
            <!--/row-->
        </div>
        <!--/.col-xs-12.col-sm-9-->

        <div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar">
            <div class="list-group text-center" >
                <h2 style="color:white;">点击量排行</h2>

                <ul class="list-inline row text-center">
<?php 
    while ($roworder=mysql_fetch_assoc($resultorder)) {
        ?>
            <li class="col-xs-12 col-lg-6">
                <img src="./posters/<?php echo $roworder["pic"]; ?>" class="responsive img-thumbnail"/>

                <p><a href="show.php?vid=<?php echo $roworder["vid"]; ?>"><?php echo $roworder["videoname"]; ?></a></p>
            </li>


<?php
    }



 ?>


                   

                </ul>
            </div>

        </div>
        <!--/.sidebar-offcanvas-->
    </div>
    <!--/row-->

    

</div>
<!--/.container-->
<?php
require_once('tpl/foot.php');
?>